<?php
include_once '../../Config/config.php';
include_once RAIZ.'Config/conexion.php';

include_once RAIZ.'Model/Autor.php';


//Franz hacer la parte de seguridad de limpieza de caracteres
$idpaper = $_POST['idpaper'];
$action = $_POST["action"];

	if($action == "movimiento-autor"){
		$idautor = $_POST['idautor'];
		$mov = $_POST["mov"];	
		Autor::MoverPosicion($idpaper, $idautor, $mov);
	}
	
	if($action == "subir-paper-final"){
		//Subiendo el abstract
		$paper = Paper::Obtener($idpaper);
		$nameFilePaperFinal = $paper->IdPaper."_PaperFinal".".".Util::extensionFile($_FILES['paperfinal']['name']);
		$FilePaperFinal = $_FILES['paperfinal']['tmp_name'];
		move_uploaded_file($FilePaperFinal, PAPERS_FINAL.$nameFilePaperFinal);
		$paper->PaperFinal = $nameFilePaperFinal;
		
		$paper->Actualizar();
		
		header("Location:index.php");
		exit();
	}
